package netdemo;

import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.SocketException;

public class UDPServer {

    public static void main(String[] args) throws Exception {

        DatagramSocket datagramSocket=new DatagramSocket(10001);
        byte []a =new byte[1024];
        DatagramPacket datagramPacket=new DatagramPacket(a,0,a.length);
        datagramSocket.receive(datagramPacket);
        byte[] data = datagramPacket.getData();
        System.out.println(new String(data,0,datagramPacket.getLength()));
        datagramSocket.close();
    }
}
